using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SunFlower : MonoBehaviour
{
    private Animator animator;
    public float bornTime;
    private float timer;
    public Transform sunPos;
    public GameObject sunPrefab;
    // Start is called before the first frame update
    void Start()
    {
        animator = GetComponent<Animator>();
        timer = 0;
    }

    // Update is called once per frame
    void Update()
    {
        timer += Time.deltaTime;
        if (timer >= bornTime)
        {            
            animator.SetBool("IsLight", true);
        }
    }
    public void BornSunOver()
    {
        BornSun();
        animator.SetBool("IsLight",false);
        timer = 0;
    }
    private void BornSun()
    {
        GameObject sun=Instantiate(sunPrefab, sunPos);
    }
}
